﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Kugar.UI.Web.AdminLTE.Helpers;
using Microsoft.AspNetCore.Mvc.Rendering;

namespace Kugar.UI.Web.AdminLTE.PageControls.PageForms
{
    public class PageForm_LabelField:PageForm_FieldBase
    {
        private string _value = "";
        private bool _isAutoHeight = false;

        public PageForm_LabelField(PageForm_Form form, ViewContext viewContext) : base(form, viewContext)
        {
            this.Css("webui-form_labelfield");
        }

        public PageForm_LabelField Value(string value)
        {
            _value = value;

            return this;
        }

        public PageForm_LabelField AutoHeight(bool isAuto = true)
        {
            _isAutoHeight = isAuto;

            return this;
        }
        
        protected override void RenderContent(TextWriter writer)
        {
            ViewContext.Writer.WriteLine($"<label class=\"form-control label-data {(_isAutoHeight ? "auto-height" : "")}\">{_value}</label>");
        }
    }
}
